package com.xywh.wanandroid.util

import java.io.File
import java.io.FileInputStream


object FileUtil {

    @Throws(Exception::class)
    fun fileToBase64(path: String?): String? {
        val file = File(path)
        val inputFile = FileInputStream(file)
        val buffer = ByteArray(file.length().toInt())
        inputFile.read(buffer)
        inputFile.close()
        return Base64Encoder.encode(buffer)
    }

}
